package com.nbjtjc.safe.mapper.sys;

import com.nbjtjc.safe.model.sys.SysRolePermission;
import com.nbjtjc.util.MyMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysRolePermissionMapper extends MyMapper<SysRolePermission> {
    @Delete("delete  from sys_role_permission   where role_id=#{roleId} ")
    int deleteByRoleId(@Param("roleId") int roleId);

    @ResultMap("BaseResultMap")
    @Select("select * from sys_role_permission rp where rp.role_id=#{roleId}")
    List<SysRolePermission> findByRoleId(@Param("roleId") int roleId);

    @Select("select sys_role_permission.permission_id from sys_role_permission" +
            " where sys_role_permission.role_id=#{roleId}")
    int[] findPermissionIds(@Param("roleId")int roleId);
}